package se.webbzon.boltzmann.battle.object.npc;

import se.webbzon.boltzmann.battle.group.BattleGroup;
import se.webbzon.boltzmann.battle.object.status.BattleStatusGroup;
import se.webbzon.boltzmann.battle.property.BattleProperty;
import se.webbzon.boltzmann.game.character.CharacterException;
import se.webbzon.boltzmann.npc.AbstractNPC;
import se.webbzon.oschi01.worldarea.WorldArea;
import se.webbzon.oschi01.worldobject.WorldObject;

public class BattleNPC extends AbstractNPC {
	
	// The walk and run speed of the non-player battle character
	private static final double walkSpeed = 2,
								runSpeed = 3;
	
	// The battle property of this non-player battle character
	private final BattleProperty property;
	
	// The battle group of this non-player battle character
	private final BattleGroup group;
	
	// The status associated with this non-player battle character.
	private BattleStatusGroup status;
	
	/*============================================================
	Constructors
	============================================================*/

	/** Creates a new non-player battle character. **/
	public BattleNPC(	BattleProperty property,
						BattleGroup group) 
				throws CharacterException {
		super(	WorldObject.onCreate + WorldObject.onDestroy,
				property.getCharacterTextureSetName(), 
				walkSpeed, runSpeed);
		this.property = property;
		this.group = group;
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	/** Returns the battle property of this non-player battle character. **/
	public BattleProperty getProperty() {
		return property;
	}
	
	/** Returns the battle group of this non-player battle character. **/
	public BattleGroup getBattleGroup() {
		return group;
	}
	
	@Override public void onCreate(WorldArea world) {
		super.onCreate(world);
		status = new BattleStatusGroup(world,this);
		world.createInstance(status);
	}
	
	@Override public void onDestroy(WorldArea world) {
		world.destroyInstance(status);
		status = null;
	}

}
